#include <stdio.h>

int main(){
	
	
	int n,i;
	double max;
	scanf("%d",&n);
	
	struct student{

    int sno;
	double s1;
	double s2;
	double s3;
	double ave;

	};
	
	struct student balls[n];
	
	for(i=0;i<n;i++){
		scanf("%d %lf %lf %lf",&balls[i].sno,&balls[i].s1,&balls[i].s2,&balls[i].s3);
		balls[i].ave=(balls[i].s1+balls[i].s2+balls[i].s3)/3;
	}
	
	max=balls[0].ave;
	
	for(i=0;i<n;i++){
		if(balls[i].ave>max){
			max=balls[i].ave;
		}
	}
		
	for(i=0;i<n;i++)
		printf("%.2lf\n",balls[i].ave);
	
	for(i=0;i<n;i++){
		if(balls[i].ave==max){
			printf("%d %.2lf\n",balls[i].sno,balls[i].ave);
		}
	}
	
	return 0;
}
